package v1

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"
	"github.com/gogf/gf/v2/os/gtime"
)

//func day() (int64, int64) {
//	var start_time int64
//	var end_time int64
//	currentYear := time.Now().Year()
//	currentMonth := time.Now().Month()
//	currentDay := time.Now().Day()
//	timeStamp := time.Date(currentYear, currentMonth, currentDay, 0, 0, 0, 0, time.Local).Unix()
//	start_time = timeStamp
//	end_time = start_time + 86400
//	return start_time, end_time
//}

type TimeSetting struct {
	Year    string
	Month   string
	Day     string
	Hour    string
	Minute  string
	Seconds string
}

func TimeGet(r *ghttp.Request) {
	year := gtime.Now().Format("Y")
	month := gtime.Now().Format("m")
	day := gtime.Now().Format("d")
	hour := gtime.Now().Format("H")
	minute := gtime.Now().Format("i")
	seconds := gtime.Now().Format("s")
	var data TimeSetting
	//data := g.Map{}
	data.Year = year
	data.Month = month
	data.Day = day
	data.Hour = hour
	data.Minute = minute
	data.Seconds = seconds
	r.Response.WriteJson(g.Map{
		"code": "1",
		"msg":  "ok",
		"data": data,
	})
}
